(function () {
  // 步骤3：创建echarts实例
  let myChart = echarts.init(document.querySelector(".box6"));

  // 步骤4：定义配置（指定图表的配置项和数据）
  option = {
    title: {
      text: '出口车逐年增减趋势'
    },
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      data: ['比亚迪', '长安', '长城', '吉利', '奇瑞']
    
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    toolbox: {
      feature: {
        saveAsImage: {}
      }
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: ['2016', '2017', '2018', '2019', '2020', '2021', '2022']
    },
    yAxis: {
        min:0,
        max:4000,
      type: 'value'
    },
    series: [
      {
        name: '比亚迪',
        type: 'line',
        stack: 'Total',
        data: [120, 132, 101, 134, 90, 230, 210]
      },
      {
        name: '长安',
        type: 'line',
        stack: 'Total',
        data: [220, 182, 191, 234, 290, 330, 310]
      },
      {
        name: '长城',
        type: 'line',
        stack: 'Total',
        data: [150, 232, 201, 154, 190, 330, 410]
      },
      {
        name: '吉利',
        type: 'line',
        stack: 'Total',
        data: [320, 332, 301, 334, 390, 330, 320]
      },
      {
        name: '奇瑞',
        type: 'line',
        stack: 'Total',
        data: [820, 932, 901, 934, 1290, 1330, 1320]
      }
    ]
  };
  // 步骤5：使用刚指定的配置项和数据显示图表
  myChart.setOption(option);

  // window.onresize = () => {
  //     myChart.resize()
  // }

  window.addEventListener("resize", () => {
    myChart.resize();
  });
})();
